<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@page import="java.util.ArrayList"%>
<%@ include file="../includes/common.jsp"%>
<%@page import="application.RestoService"%>
<%
	String price_total = request.getParameter("price_total");
	id_client = request.getParameter("id_client");
	date_eat = request.getParameter("date_eat");
	time_eat = request.getParameter("time_eat");
	String food_list = request.getParameter("food_list");
	String user_id = (String) session.getAttribute("user_id");
	RestoService resto = new RestoService();
	ArrayList<String> employ = new ArrayList<String>();
	if (user_id != null && user_id != "")
		employ = resto.listClientWithUserID(user_id);
	ArrayList<String> client = new ArrayList<String>();
	client = resto.listClientWithID(id_client);
	if(client.size() > 1)
		name_client = client.get(1);
	String id_employ = "";
	if (employ.size() > 0)
		id_employ = employ.get(0);
	String from = resto.getEmailClient(id_employ);
	String to = resto.getEmailClient(id_client);
	
	
	
	
	String subject = "[RESTO DU MONDE]Verification de reservation";
	String content = "Bonjour " + name_client
			+ ",\n"
			+ "Merci de votre reservation. Ci-dessous est le detaille de la reservation: \n"
			+ "- Plats: " + food_list + "\n"
			+ "- Prix: " + price_total + "\n"
			+ "- Date de manger: " + date_eat + "\n"
			+ "- Temps de manger: " + time_eat  + "\n"
			+ "Bien a vous, \n";
	resto.sendMail("nqkhai1706@gmail.com", to, subject, content);

	response.sendRedirect("reservation_view_admin.jsp");
%>